import wx

class MyPanel(wx.Panel):
    def __init__(self, *args, **kwargs):
        super(MyPanel, self).__init__(*args, **kwargs)
        self.Bind(wx.EVT_BUTTON, self.OnButtonClicked)
    def OnButtonClicked(self, e):
        print('event reach my panel')
        e.Skip()

class MyButton(wx.Button):
    def __init__(self, *args, **kwargs):
        super(MyButton, self).__init__(*args, **kwargs)
        self.Bind(wx.EVT_BUTTON, self.OnButtonClicked)
    def OnButtonClicked(self, e):
        print('event reach my button')
        e.Skip()

class Example(wx.Frame):
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title)
        self.InitUI()
    def InitUI(self):
        mpnl = MyPanel(self)
        MyButton(mpnl, label='ok', pos=(15,15))
        self.Bind(wx.EVT_BUTTON, self.OnButtonClicked)
    def OnButtonClicked(self, e):
        print('event reach frame class')
        e.Skip()

def main():
    app = wx.App()
    frame = Example(None, title='event propagation')
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
